<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div>
  <div *ngIf="dcrIsEnabled">
    <div fxLayout="column" fxFlex="70">
      <form (ngSubmit)="patch()" #defaultScopeForm="ngForm" fxLayout="column">
        <div class="gv-form-section">
          <scope-selection
            [initialSelectedScopes]="initialSelectedScopes"
            [readonly]="readonly"
            (onScopeSelection)="onChange($event)">
          </scope-selection>
        </div>
        <div *ngIf="!readonly">
          <button mat-raised-button [disabled]="(!defaultScopeForm.valid || defaultScopeForm.pristine) && !formChanged" type="submit">SAVE</button>
        </div>
      </form>
    </div>
    <div class="gv-page-description" fxFlex>
      <h3>Default scopes</h3>
      <div class="gv-page-description-content">
        <p>
          This section is used to define some default scope to be automatically added when a client is created through the Openid Connect Dynamic Client Registration endpoint, without any requested scopes.
        </p>
        <small><i>As the <a href="https://tools.ietf.org/html/rfc7591#section-2" target="_blank">specification</a> state: If omitted, an authorization server MAY register a client with a default set of scopes.</i></small>
      </div>
    </div>
  </div>
  <app-emptystate *ngIf="!dcrIsEnabled"
                  [message]="'Openid Connect Dynamic Client Registration is disabled.'"
                  [subMessage]="'This feature can be enable through the Settings tab.'">
  </app-emptystate>
</div>
